﻿/*!
 *  @brief     閫氱敤宸ュ叿绫?
 *  @details   瀹氫箟閫氱敤鐨勫嚱鏁板伐鍏?
 *  @author    Will.Yin
 *  @version   v1.0
 *  @date      2021-09-17
 *  @copyright Eoslift.
 *  @note
 */
#ifndef UTIL_H
#define UTIL_H

#include <QObject>
#include <QSettings>
#include <QDateTime>
#include <QImage>

#include "common_global.h"

namespace Common {

	class COMMONSHARED_EXPORT Util : public QObject
	{
	public:
		/*! <UUid鐢熸垚鍣? */
		static QString RgUUID();
		static QString UUID();

		/*!< 缃戠粶 灏嗘暣褰?闀挎暣褰㈣浆鎹㈡垚ip鍦板潃銆乵ac鍦板潃 */
		static QString swithIntToIp(int value, bool reverse = true);
		static QString swithLongToMac(long value);
		static quint32 swithIpv4StringToInteger(const QString &ip);

		static QString replaceLongTextWidthElide(const QFont & font, const QString & origin, const int maxLen);

		/*!< 灞忓箷淇℃伅 */
		static QSize screenSize(int num = -1);
		static QRect screenGeometry();
		static QRect centerScreen(QSize & widgetSize);

		static bool validateIpFormat(QString dest);

		static QImage convertToGray(const QImage &t_image);

		static void StringToHtml(QString &targetHtml);
		static void escapeSingleQuote(QString &targetHtml);
		static void escapeBracketsQuote(QString &targetHtml);
		static void escapeLFQuote(QString &targetHtml);
		static void removeEccapeSingleQuote(QString &targetHtml);
		static void escapeDoubleQuote(QString &targetHtml);
		static void removeEccapeDoubleQuote(QString &targetHtml);

		static void showInExplorer(QString &pathIn);
		static QString formatFileSize(int byteSize);

	};

}//namespace General

#endif // UTIL_H
